/**
 * ChannelHandler.java 2020/5/13 7:32 下午 Copyright ©2020 www.bmsoft.com.cn All rights reserved.
 * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package remoting.channel;

import common.exception.RemotingException;

/**
 * File：ChannelHandler.java<br>
 * Title: <br>
 * Description: <br>
 * Company: www.treefinance.com.cn <br>
 * @author heyouchi
 * Date: 2020/5/13
 */
public interface ChannelHandler {

  /**
   * on channel connected.
   *
   * @param channel channel.
   */
  void connected(Channel channel) throws RemotingException;

  /**
   * on channel disconnected.
   *
   * @param channel channel.
   */
  void disconnected(Channel channel) throws RemotingException;

  /**
   * on message sent.
   *
   * @param channel channel.
   * @param message message.
   */
  void sent(Channel channel, Object message) throws RemotingException;

  /**
   * on message received.
   *
   * @param channel channel.
   * @param message message.
   */
  void received(Channel channel, Object message) throws RemotingException;

  /**
   * on exception caught.
   *
   * @param channel   channel.
   * @param exception exception.
   */
  void caught(Channel channel, Throwable exception) throws RemotingException;
}
